<?php

/**
 * Name: 设置验证层
 * User: Silent
 * Date: 2025-09-20
 * Time: 22:44:03
 */

namespace App\Http\Requests\Config;

use Illuminate\Foundation\Http\FormRequest;

class ConfigRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'name'          => 'required|string|max:100',
            'supervisor_id' => 'nullable|exists:users,id',
            'description'   => 'nullable|string|max:500',
        ];
    }

    public function messages()
    {
        return [
            'name.required'        => '班组名称不能为空',
            'name.max'             => '班组名称不能超过100个字符',
            'supervisor_id.exists' => '选择的负责人不存在',
            'description.max'      => '描述不能超过500个字符',
        ];
    }
}
